<template>
  <div>
    <h1>{{time}}</h1>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: 5
    };
  },

  async mounted() {
      console.log(this);
    await setInterval(() => {
      this.time -= 1;
    }, 1000);
  },
  watch: {
    time: function(val){
      console.log(this);
      if(val==0){
          this.$router.push({name:"Home"})
      }
    }
  }
};
</script>

<style scoped>
</style>